ValueFolderTemp='C:\Users\Remy Neveu\Desktop\Etude IRM\Analyse\cc in2p3\Nature\ResultsJournal\';
ValueFolderTemp2='C:\Users\Remy Neveu\Desktop\Etude IRM\Analyse\cc in2p3\Nature\ResultsEditor\';
load([ValueFolderTemp 'ResultsThirdLevelDistributionOutliers.mat']);
VecDistribution=VecResults;
load('C:\Users\Remy Neveu\Desktop\Etude IRM\Analyse\cc in2p3\Nature\EtudeNature.mat');
VecEditors1Temp(1,:)=[];
VecValueEditor=VecEditors1Temp;
load('C:\Users\Remy Neveu\Desktop\Etude IRM\Analyse\cc in2p3\Nature\DonneesNature.mat');
VecValueJournal=VecJournalTemp;
ValueCutoff=1.25;
VecFigure=[];
VecFigure2=[];
VecFigure3=[];
VecFigure5=[];
for n1=1:323
    n1
    ValueTemp=find(VecDistribution(:,1)==n1);
    ValueStartEditor=VecValueEditor{n1,22};
    n5Temp5=0;
    if size(ValueTemp,1)==1&&n1~=11
        if VecDistribution(ValueTemp,2)<=ValueCutoff
            ValueJournal=VecValueEditor{n1,11};
            n3=1;
            TestTemp=0;
            while n3<=size(VecValueJournal,1)&&TestTemp==0
                if strcmpi(ValueJournal,VecValueJournal{n3,1})==1
                    TestTemp=1;
                else
                    n3=n3+1;
                end
            end
%             ValueFileTemp4=dir([ValueFolderTemp2 'FileAnalysisEditorCoAuthors' num2str(n1) 'RestrictedYear2Month8.mat']);
%             if size(ValueFileTemp4,1)==1
                load([ValueFolderTemp2 'FileAnalysisEditorCoAuthors' num2str(n1) 'RestrictedYear2Month8.mat']);
                load([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n1) '.mat']);
                VecValueTemp24=[];
                VecValueTemp25=[];
                VecValueTemp24Temp=[];
                VecValueTemp25Temp=[];
                ValueTime=clock();
                for n2=1:33
                    if n2==n3
                        eval(['VecValueTemp=VecResultsCoAuthors' num2str(n2) 'j1y1m2;']);
                        VecValueTemp22=VecValueTemp';
                        eval(['VecValueTemp=VecResultsOtherAuthors' num2str(n2) 'j1y1m2;']);
                        VecValueTemp23=VecValueTemp';
                    else
                        eval(['VecValueTemp=VecResultsCoAuthors' num2str(n2) 'j1y1m1;']);
                        if size(VecValueTemp24,2)==0&&size(VecValueTemp,2)>=1
                            VecValueTemp24=VecValueTemp;
                            eval(['VecValueTemp2=VecResultsNameCoAuthors' num2str(n2) 'j1y1m;']);
                            VecValueTemp24Temp=VecValueTemp2;
                        else
                            if size(VecValueTemp,2)>=1
                                eval(['VecValueTemp2=VecResultsNameCoAuthors' num2str(n2) 'j1y1m;']);
                                for n4=1:size(VecValueTemp2,2)
                                    n5=1;
                                    TestTemp=0;
                                    while TestTemp==0&&n5<=size(VecValueTemp24Temp,2)
                                        if size(VecValueTemp24Temp{1,n5},2)==size(VecValueTemp2{1,n4},2)&&sum(abs(VecValueTemp24Temp{1,n5}-VecValueTemp2{1,n4}))==0
                                            TestTemp=1;
                                        else
                                            n5=n5+1;
                                        end
                                    end
                                    if n5<=size(VecValueTemp24Temp,2)
                                        VecValueTemp24(:,n5)=VecValueTemp24(:,n5)+VecValueTemp(:,n4);
                                    else
                                        VecValueTemp24(:,n5)=VecValueTemp(:,n4);
                                        VecValueTemp24Temp(1,n5)={VecValueTemp2{1,n4}};
                                    end
                                end
                                if size(VecValueTemp2,2)>0
                                    n5Temp5=n5Temp5+1;
                                end
                            end
                        end
                    end
%                     eval(['VecValueTemp=VecResultsOtherAuthors' num2str(n2) 'j1y1m1;']);
%                     if size(VecValueTemp25,2)==0&&size(VecValueTemp,2)>=1
%                         VecValueTemp25=VecValueTemp;
%                         eval(['VecValueTemp2=VecResultsNameOtherAuthors' num2str(n2) 'j1y1m;']);
%                         VecValueTemp25Temp=VecValueTemp2;
%                     else
%                         if size(VecValueTemp,2)>=1
%                             eval(['VecValueTemp2=VecResultsNameOtherAuthors' num2str(n2) 'j1y1m;']);
%                             for n4=1:size(VecValueTemp2,2)
%                                 n5=1;
%                                 TestTemp=0;
%                                 while TestTemp==0&&n5<=size(VecValueTemp25Temp,2)
%                                     if size(VecValueTemp25Temp{1,n5},2)==size(VecValueTemp2{1,n4},2)&&sum(abs(VecValueTemp25Temp{1,n5}-VecValueTemp2{1,n4}))==0
%                                         TestTemp=1;
%                                     else
%                                         n5=n5+1;
%                                     end
%                                 end
%                                 if n5<=size(VecValueTemp25Temp,2)
%                                     VecValueTemp25(:,n5)=VecValueTemp25(:,n5)+VecValueTemp(:,n4);
%                                 else
%                                     VecValueTemp25(:,n5)=VecValueTemp(:,n4);
%                                     VecValueTemp25Temp(1,n5)={VecValueTemp2{1,n4}};
%                                 end
%                             end
%                         end
%                     end
                end
                ValueTime2=clock();
                ValueTimeTemp=(ValueTime2(1,4)-ValueTime(1,4))*60+ValueTime2(1,5)-ValueTime(1,5);
                VecValueTemp24=VecValueTemp24';
                VecValueTemp25=VecValueTemp25';
                if size(VecValueTemp22,2)>=1&&size(VecValueTemp23,2)>=1&&size(VecValueEditor{n1,22},2)<=3
                    % First column of VecValueTemp22 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
                    VecFigure3=[VecFigure3;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
                    VecFigure3=[VecFigure3;VecValueTemp23 VecValueTemp23(:,1)+VecValueTemp23(:,2) VecValueTemp23(:,1)-VecValueTemp23(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp23,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp23,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp23,1),1) n3*ones(size(VecValueTemp23,1),1) 2*ones(size(VecValueTemp23,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp23,1),1) n1*ones(size(VecValueTemp23,1),1)];
                    ValueTemp=find(VecValueTemp22(:,1)==0&VecValueTemp22(:,2)>0);
                    ValueTemp2=find(VecValueTemp23(:,1)==0&VecValueTemp23(:,2)>0);
                    VecFigure5=[VecFigure5;size(ValueTemp,1) size(VecValueTemp22,1) size(ValueTemp2,1) size(VecValueTemp23,1)];
                end
                if size(VecValueTemp24,2)>=1&&size(VecValueTemp22,2)>=1&&size(VecValueEditor{n1,22},2)<=3
                    % First column of VecValueTemp24 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
                    VecFigure2=[VecFigure2;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
%                     VecFigure2=[VecFigure2;VecValueTemp24/n5Temp (VecValueTemp24(:,1)+VecValueTemp24(:,2))/n5Temp (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
                    VecFigure2=[VecFigure2;VecValueTemp24 VecValueTemp24(:,1)+VecValueTemp24(:,2) VecValueTemp24(:,1)-VecValueTemp24(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
                end
%                 % Robustness analysis (we average over the number of Nature journals)
%                 if size(VecValueTemp24,2)>=1&&size(VecValueTemp22,2)>=1&&size(VecValueEditor{n1,22},2)<=3&&n5Temp5>0
%                     % First column of VecValueTemp24 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
%                     VecFigure2=[VecFigure2;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
% %                     VecFigure2=[VecFigure2;VecValueTemp24/n5Temp (VecValueTemp24(:,1)+VecValueTemp24(:,2))/n5Temp (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
%                     VecFigure2=[VecFigure2;VecValueTemp24/n5Temp5 VecValueTemp24(:,1)+VecValueTemp24(:,2) (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp5 VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
%                 end
%             end
        end
    end
end

% VecFigure4=VecFigure;
% VecFigure=VecFigure2;
% VecFigure=VecFigureTemp;
% VecFigureTemp=VecFigure;
VecFigure=VecFigure3;
ValueTemp=find(VecFigure(:,3)==0);
% ValueTemp=find(VecFigure(:,3)>8);
VecFigure(ValueTemp,:)=[];
[ValueTemp,ValueTemp2]=RemoveOutliers2(VecFigure,5,3);
VecFigure=ValueTemp;
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
% VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
% ValueResults=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
% ValueResults
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==1
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel1=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel1Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel1Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==2
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('E',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==2);
VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
% Model for the analysis comparing the number of articles of former co-authors and the ther authors in the editor's journal
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel2=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel2Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel2Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel3=fitlme(VecValueTemp4,'Articles~CategoryAuthor*Variable1+CategoryAuthor*Variable27+(1|Editor)','FitMethod','REML');

% % Saving data for sharing
% VecValueTemp=repmat('E',size(VecFigure,1),1);
% ValueTemp=find(VecFigure(:,9)==2);
% VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
% VecFigure=[VecFigure(:,4) VecFigure(:,11)];
% save('C:\Users\Remy Neveu\Desktop\Tests_R\AnalyseEtudeIRM\Nature\Statistical analyses\2nd set of results\AnalyseMixedModelCoAuthorsEditorJournal.mat','VecFigure','VecValueTemp');

return

VecFigure=VecFigure2;
ValueTemp=find(VecFigure(:,3)==0);
% ValueTemp=find(VecFigure(:,3)>8);
VecFigure(ValueTemp,:)=[];
% ValueTemp=find(abs(VecFigure(:,3)-mean(VecFigure(:,3)))<3*sqrt(var(VecFigure(:,3))));
% VecFigure=VecFigure(ValueTemp,:);
[ValueTemp,ValueTemp2]=RemoveOutliers2(VecFigure,5,3);
VecFigure=ValueTemp;
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
% VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
% ValueResults=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
% ValueResults
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==1
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel4=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel4Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel4Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==2
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('E',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==2);
VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel5=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel5Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel5Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel6=fitlme(VecValueTemp4,'Articles~CategoryAuthor*Variable1+CategoryAuthor*Variable27+(1|Editor)','FitMethod','REML');

% % Saving data for sharing
% VecValueTemp=repmat('E',size(VecFigure,1),1);
% ValueTemp=find(VecFigure(:,9)==2);
% VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
% VecFigure=[VecFigure(:,4) VecFigure(:,11)];
% save('C:\Users\Remy Neveu\Desktop\Tests_R\AnalyseEtudeIRM\Nature\Statistical analyses\2nd set of results\AnalyseMixedModelCoAuthorsOnlyAllJournals.mat','VecFigure','VecValueTemp');

return

[ValueResults2,ValueResults2Temp]=ttest(VecFigure5(:,1)./VecFigure5(:,2)-VecFigure5(:,3)./VecFigure5(:,4))
[ValueResults2,ValueResults2Temp]=signrank(VecFigure5(:,1)./VecFigure5(:,2)-VecFigure5(:,3)./VecFigure5(:,4))

VecFigure=[];
VecFigure2=[];
VecFigure3=[];
VecFigure5=[];
for n1=1:323
    n1
    ValueTemp=find(VecDistribution(:,1)==n1);
    ValueStartEditor=VecValueEditor{n1,22};
    n5Temp5=0;
    if size(ValueTemp,1)==1&&n1~=11
        if VecDistribution(ValueTemp,2)<=ValueCutoff
            ValueJournal=VecValueEditor{n1,11};
            n3=1;
            TestTemp=0;
            while n3<=size(VecValueJournal,1)&&TestTemp==0
                if strcmpi(ValueJournal,VecValueJournal{n3,1})==1
                    TestTemp=1;
                else
                    n3=n3+1;
                end
            end
            load([ValueFolderTemp2 'FileAnalysisEditorCoAuthors' num2str(n1) 'RestrictedYear2Month8.mat']);
            load([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n1) '.mat']);
            VecValueTemp24=[];
            VecValueTemp25=[];
            VecValueTemp24Temp=[];
            VecValueTemp25Temp=[];
            ValueTime=clock();
            for n2=1:33
                if n2==n3
                    eval(['VecValueTemp=VecResultsCoAuthors' num2str(n2) 'j1y1m2Filtered;']);
                    VecValueTemp22=VecValueTemp';
                    eval(['VecValueTemp=VecResultsOtherAuthors' num2str(n2) 'j1y1m2Filtered;']);
                    VecValueTemp23=VecValueTemp';
                else
                    eval(['VecValueTemp=VecResultsCoAuthors' num2str(n2) 'j1y1m1Filtered;']);
                    if size(VecValueTemp24,2)==0&&size(VecValueTemp,2)>=1
                        VecValueTemp24=VecValueTemp;
                        eval(['VecValueTemp2=VecResultsNameCoAuthors' num2str(n2) 'j1y1mFiltered;']);
                        VecValueTemp24Temp=VecValueTemp2;
                    else
                        if size(VecValueTemp,2)>=1
                            eval(['VecValueTemp2=VecResultsNameCoAuthors' num2str(n2) 'j1y1mFiltered;']);
                            for n4=1:size(VecValueTemp2,2)
                                n5=1;
                                TestTemp=0;
                                while TestTemp==0&&n5<=size(VecValueTemp24Temp,2)
                                    if size(VecValueTemp24Temp{1,n5},2)==size(VecValueTemp2{1,n4},2)&&sum(abs(VecValueTemp24Temp{1,n5}-VecValueTemp2{1,n4}))==0
                                        TestTemp=1;
                                    else
                                        n5=n5+1;
                                    end
                                end
                                if n5<=size(VecValueTemp24Temp,2)
                                    VecValueTemp24(:,n5)=VecValueTemp24(:,n5)+VecValueTemp(:,n4);
                                else
                                    VecValueTemp24(:,n5)=VecValueTemp(:,n4);
                                    VecValueTemp24Temp(1,n5)={VecValueTemp2{1,n4}};
                                end
                            end
                            if size(VecValueTemp2,2)>0
                                n5Temp5=n5Temp5+1;
                            end
                        end
                    end
                end
            end
            ValueTime2=clock();
            ValueTimeTemp=(ValueTime2(1,4)-ValueTime(1,4))*60+ValueTime2(1,5)-ValueTime(1,5);
            VecValueTemp24=VecValueTemp24';
            VecValueTemp25=VecValueTemp25';
            if size(VecValueTemp22,2)>=1&&size(VecValueTemp23,2)>=1&&size(VecValueEditor{n1,22},2)<=3
                % First column of VecValueTemp22 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
                VecFigure3=[VecFigure3;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
                VecFigure3=[VecFigure3;VecValueTemp23 VecValueTemp23(:,1)+VecValueTemp23(:,2) VecValueTemp23(:,1)-VecValueTemp23(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp23,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp23,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp23,1),1) n3*ones(size(VecValueTemp23,1),1) 2*ones(size(VecValueTemp23,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp23,1),1) n1*ones(size(VecValueTemp23,1),1)];
                ValueTemp=find(VecValueTemp22(:,1)==0&VecValueTemp22(:,2)>0);
                ValueTemp2=find(VecValueTemp23(:,1)==0&VecValueTemp23(:,2)>0);
                VecFigure5=[VecFigure5;size(ValueTemp,1) size(VecValueTemp22,1) size(ValueTemp2,1) size(VecValueTemp23,1)];
            end
            if size(VecValueTemp24,2)>=1&&size(VecValueTemp22,2)>=1&&size(VecValueEditor{n1,22},2)<=3
                % First column of VecValueTemp24 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
                VecFigure2=[VecFigure2;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
%                     VecFigure2=[VecFigure2;VecValueTemp24/n5Temp (VecValueTemp24(:,1)+VecValueTemp24(:,2))/n5Temp (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
                VecFigure2=[VecFigure2;VecValueTemp24 VecValueTemp24(:,1)+VecValueTemp24(:,2) VecValueTemp24(:,1)-VecValueTemp24(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
            end
%             % Robustness analysis (we average over the number of Nature journals)
%             if size(VecValueTemp24,2)>=1&&size(VecValueTemp22,2)>=1&&size(VecValueEditor{n1,22},2)<=3&&n5Temp5>0
%                 % First column of VecValueTemp24 and VecValueTemp23 correspond to after the arrivla of the editor while the second column corresponds to before.
%                 VecFigure2=[VecFigure2;VecValueTemp22 VecValueTemp22(:,1)+VecValueTemp22(:,2) VecValueTemp22(:,1)-VecValueTemp22(:,2) VecResultsEditor(1,1)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp22,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp22,1),1) n3*ones(size(VecValueTemp22,1),1) ones(size(VecValueTemp22,1),1) size(VecValueTemp22,1)*ones(size(VecValueTemp22,1),1) n1*ones(size(VecValueTemp22,1),1)];
% %                     VecFigure2=[VecFigure2;VecValueTemp24/n5Temp (VecValueTemp24(:,1)+VecValueTemp24(:,2))/n5Temp (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
%                 VecFigure2=[VecFigure2;VecValueTemp24/n5Temp5 VecValueTemp24(:,1)+VecValueTemp24(:,2) (VecValueTemp24(:,1)-VecValueTemp24(:,2))/n5Temp5 VecResultsEditor(1,1)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,16)*ones(size(VecValueTemp24,1),1) VecResultsEditor(1,27)*ones(size(VecValueTemp24,1),1) n3*ones(size(VecValueTemp24,1),1) 2*ones(size(VecValueTemp24,1),1) size(VecValueTemp24,1)*ones(size(VecValueTemp24,1),1) n1*ones(size(VecValueTemp24,1),1)];
%             end
        end
    end
end

VecFigure=VecFigure3;
ValueTemp=find(VecFigure(:,3)==0);
% ValueTemp=find(VecFigure(:,3)>8);
VecFigure(ValueTemp,:)=[];
[ValueTemp,ValueTemp2]=RemoveOutliers2(VecFigure,5,3);
VecFigure=ValueTemp;
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
% VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
% ValueResults=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
% ValueResults
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==1
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel1=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel1Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel1Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp&VecFigure(:,9)==2);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==2
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('E',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==2);
VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel2=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel2Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel2Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel3=fitlme(VecValueTemp4,'Articles~CategoryAuthor*Variable1+CategoryAuthor*Variable27+(1|Editor)','FitMethod','REML');

VecFigure=VecFigure2;
ValueTemp=find(VecFigure(:,3)==0);
% ValueTemp=find(VecFigure(:,3)>8);
VecFigure(ValueTemp,:)=[];
[ValueTemp,ValueTemp2]=RemoveOutliers2(VecFigure,5,3);
VecFigure=ValueTemp;
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
% VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
% ValueResults=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
% ValueResults
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==1
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('O',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==1);
VecValueTemp(ValueTemp,1)=repmat('E',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel4=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel4Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel4Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
TestTemp=0;
ValueTemp=1;
while ValueTemp<=max(VecFigure(:,11))&&TestTemp==0
    ValueTemp2=find(VecFigure(:,11)==ValueTemp&VecFigure(:,9)==2);
    if size(ValueTemp2,1)>=1
        VecValueTemp2=VecFigure(ValueTemp2,:);
        if VecValueTemp2(1,9)==2
            TestTemp=1;
        end
    end
    ValueTemp=ValueTemp+1;
end
VecFigure(ValueTemp2,:)=[];
VecFigure=[VecValueTemp2;VecFigure];
VecValueTemp=repmat('E',size(VecFigure,1),1);
ValueTemp=find(VecFigure(:,9)==2);
VecValueTemp(ValueTemp,1)=repmat('O',size(ValueTemp,1),1);
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel5=fitlme(VecValueTemp4,'Articles~CategoryAuthor+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,1);VecFigure(:,2)],[VecValueTemp;VecValueTemp],[repmat('A',size(VecFigure,1),1);repmat('B',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel5Temp=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
VecValueTemp4=table([VecFigure(:,2);VecFigure(:,1)],[VecValueTemp;VecValueTemp],[repmat('B',size(VecFigure,1),1);repmat('A',size(VecFigure,1),1)],[VecFigure(:,11);VecFigure(:,11)],'VariableNames',{'Articles','CategoryAuthor','CategoryArticle','Editor'});
ValueResultsModel5Temp2=fitlme(VecValueTemp4,'Articles~CategoryAuthor*CategoryArticle+(1|Editor)','FitMethod','REML');
for n1=1:3
    ValueTemp=find(isnan(VecFigure(n1+4,:))==1);
    if size(ValueTemp,1)>0
        VecFigure(ValueTemp,:)=[];
        VecValueTemp(ValueTemp,:)=[];
    end
end
VecValueTemp4=table(VecFigure(:,4),VecFigure(:,5),VecFigure(:,6),VecFigure(:,7),VecValueTemp,VecFigure(:,11),VecFigure(:,10),'VariableNames',{'Articles','Variable1','Variable16','Variable27','CategoryAuthor','Editor','CoAuthors'});
ValueResultsModel6=fitlme(VecValueTemp4,'Articles~CategoryAuthor*Variable1+CategoryAuthor*Variable27+(1|Editor)','FitMethod','REML');

% save([ValueFolderTemp2 'ResultsFourthLevelEditorCoAuthorsFiltered.mat'],'ValueResultsModel1','ValueResultsModel1Temp','ValueResultsModel1Temp2','ValueResultsModel2','ValueResultsModel2Temp','ValueResultsModel2Temp2','ValueResultsModel3','ValueResultsModel4','ValueResultsModel4Temp','ValueResultsModel4Temp2','ValueResultsModel5','ValueResultsModel5Temp','ValueResultsModel5Temp2','ValueResultsModel6');

% save([ValueFolderTemp2 'AnalyseMixedModelFourthLevelCoAuthorsNonFiltered.mat'],'VecFigure');




